Setting User-Defined Attributes

In Modeler, users can set arbitrary key-value pair strings on objects with a script command (this functionality is not available in the software interface). These user-defined attributes will be preserved when the model is exported as a JT or Step file for use in third-party CAD files, such as NX:

UDA properties visible in NX

They will also be recognized if the model is reimported into Ansys Electronics Desktop.

Note: JT export does not support line body export. So an imported model will lose the line bodies, but user-defined attributes are maintained on exported object and sheet bodies.

The commands related to this functionality are listed below:

SetObjectAttributeValues

UI Access None
Parameters
Name Type Description
<objectName> String

Object to apply the attribute to; it can be a 3D object, a sheet or a line.

<Type> String Only possible value is "AEDTUDA"
<AttributePairs> Array List of key name and key value pairs
Return Value Returns a value of 1 if attribute is successfully set

 

Python Syntax SetObjectAttributeValues(<objectName>, "AEDTUDA", [“keyName”, “KeyValue”,..])
Python Example

oEditor = oDesign.SetActiveEditor("3D Modeler")

oEditor.SetObjectAttributeValues("Box1", "AEDTUDA", ["box_attribute", "box_value"])

oEditor.SetObjectAttributeValues("Rectangle1", "AEDTUDA", ["sheet_attribute", "sheet_value"])

oEditor.SetObjectAttributeValues("Line1", "AEDTUDA", ["line_attribute", "line_value"])

GetObjectAttributeValues

UI Access None
Parameters
Name Type Description
<objectName> String Name of object to query
<Type> String Only possible value is "AEDTUDA"
<stringFilter> String Allows you to filter for specific UDAs and values if multiple UDAs are assigned to an object. Leave blank to query for all UDAs assigned to an object
Return Value List of key value pairs​

 

Python Syntax GetObjectAttributeValues(<objectName>, "AEDTUDA", <stringFilter>)
Python Example

oEditor = oDesign.SetActiveEditor("3D Modeler")

oEditor.GetObjectAttributeValues("Box1", "AEDTUDA", [" "])

Returns ["box_attribute", "box_value"]

RemoveObjectAttributeValues

UI Access None
Parameters
Name Type Description
<objectName> String Name of object that has the UDAs you want to remove
<Type> String Only possible value is "AEDTUDA"
<stringFilter> String Allows you to filter for specific UDAs and values if multiple UDAs are assigned to an object. Leave blank to delete all UDAs assigned to an object
Return Value Returns a value of 1 if attribute is successfully deleted​

 

Python Syntax RemoveObjectAttributeValues(<objectName>, "AEDTUDA", <stringFilter>)
Python Example

oEditor = oDesign.SetActiveEditor("3D Modeler")

oEditor.RemoveObjectAttributeValues("Box1", "AEDTUDA", [" "])

UDAs are available and editable when the component is open for editing. The UDAs of the component parts cannot be accessed or queried from the project/design level.

To edit a component, make sure to call it first:

oEditor = oDesign.SetActiveEditor("3D Modeler")

oProject.GetName()

'uda_comp'

oEditor.GetObjectAttributeValues("Box1", "AEDTUDA", [" "])